package edu.nf.ch11.pool;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.sql.Connection;

/**
 * @author CSY
 * @date 2025 - 04 - 18
 */
public class PoolInvocationHandler implements InvocationHandler {
    private Object target;

    public PoolInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        /*if(method.getName().equals("close")){
            ConnectionPool.getPool().addLast((Connection) target);
        }*/
        Object returnVal = method.invoke(target, args);
        return returnVal;
    }
}
